package com.xianniu.ltc.service.impl;


import com.alibaba.fastjson.JSONArray;
import com.xianniu.ltc.enums.StatisticsTimeGroupEnum;
import com.xianniu.ltc.model.vo.statistics.SelectListVO;
import com.xianniu.ltc.service.XnStatisticsEnumService;
import org.springframework.stereotype.Service;

import java.util.*;
@Service
public class XnStatisticsEnumImpl implements XnStatisticsEnumService {

    @Override
    public JSONArray getTimeGroupList(){
        List<SelectListVO> timeList = new ArrayList<SelectListVO>();
        for( StatisticsTimeGroupEnum timeG : EnumSet.allOf(StatisticsTimeGroupEnum.class) ){

            SelectListVO sl = new SelectListVO();
            sl.setValue( timeG.key.toString() );
            sl.setLabel( timeG.value );
            timeList.add(sl);
        }
        JSONArray jsonArray = (JSONArray) JSONArray.toJSON(timeList);
        return jsonArray;
    }
}
